package com.appchina.autism.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.appchina.autism.R;

public class ItemView extends LinearLayout{
	
	private LayoutInflater layoutInflater;
	private LinearLayout rootLinearLayout;
	private ImageView imageView;
	private TextView textView;
	

	public ItemView(Context context) {
		this(context, null);
	}

	public ItemView(Context context, AttributeSet attrs) {
		super(context, attrs);
		
		layoutInflater = LayoutInflater.from(context);
		rootLinearLayout = (LinearLayout)layoutInflater.inflate(R.layout.common_widget_item, this, true);
		imageView = (ImageView)rootLinearLayout.findViewById(R.id.common_widget_item_img);
		textView = (TextView)rootLinearLayout.findViewById(R.id.common_widget_item_text);
	}
	
	public void setContent(int imgResId, String text) {
		imageView.setImageResource(imgResId);
		textView.setText(text);
	}
	
	public void setContent(int imgResId, int strId) {
		imageView.setImageResource(imgResId);
		textView.setText(strId);
	}
	
}
